import type {
  GetPatientMylistItem,
  PostPatientAddData,
  PostPatientAddParams,
} from '@/types/patient'
import { request } from '@/utils/request'

/**
 * 添加患者
 * @param 患者姓名,身份证件号码,性别,是否设置为默认患者
 * @returns 患者id
 */
export const PostPatientAddAPI = (params: PostPatientAddParams) => {
  return request<PostPatientAddData>('/patient/add', 'POST', params)
}

/**
 * 获取患者列表
 * @returns 患者列表
 */
export const getPatientListAPI = () => {
  return request<GetPatientMylistItem[]>('/patient/mylist', 'GET')
}

/**
 * 删除患者
 * @param id 患者id
 * @returns
 */
export const deletePatientAPI = (id: string) => {
  return request(`/patient/del/${id}`, 'DELETE')
}

/**
 * 问诊-查询患者详情
 * @param id 患者 id
 * @returns 返回患者详情
 */
export const getPatientInfoByIdAPI = (id: string) => {
  return request<GetPatientMylistItem>(`/patient/info/${id}`)
}
// 问诊-编辑患者信息
// PUT
// /patient/update

export const updatePatientInfoAPI = (params: PostPatientAddParams) => {
  return request('/patient/update', 'PUT', params)
}

